#include <sys/select.h>
#include <sys/socket.h>
#include <xen/io/ring.h>
+#include <xc_private.h>
#include <err.h>
#include "sys-queue.h"
#include "fs-backend.h"
{
struct fs_mount *mount;
struct fs_export *export;
- int evt_port;
struct fsif_sring *sring;
uint32_t dom_ids[MAX_RING_SIZE];
int i;
}
if (FD_ISSET(pipefds[0], &fds)) {
struct fs_request *request;
- int ret;
- ret = read(pipefds[0], &request, sizeof(struct fs_request *));
- if (ret != sizeof(struct fs_request *)) {
- fprintf(stderr, "read request failed\n");
- continue;
- }
+ if (read_exact(pipefds[0], &request, sizeof(struct fs_request *)) < 0)
+ err(1, "read request failed\n");
handle_aio_event(request);
}
LIST_FOREACH(pointer, &mount_requests_head, entries) {
{
struct fs_request *request = (struct fs_request*) info->si_value.sival_ptr;
int saved_errno = errno;
- write(pipefds[1], &request, sizeof(struct fs_request *));
+ if (write_exact(pipefds[1], &request, sizeof(struct fs_request *)) < 0)
+ err(1, "write request filed\n");
errno = saved_errno;
}
{
char *file_name, full_path[BUFFER_SIZE];
int fd;
- struct timeval tv1, tv2;
RING_IDX rsp_idx;
fsif_response_t *rsp;
uint16_t req_id;
static void dispatch_file_read(struct fs_mount *mount, struct fsif_request *req)
{
void *buf;
- int fd, i, count;
+ int fd, count;
uint16_t req_id;
unsigned short priv_id;
struct fs_request *priv_req;
priv_req->aiocb.aio_sigevent.sigev_value.sival_ptr = priv_req;
assert(aio_read(&priv_req->aiocb) >= 0);
-out:
/* We can advance the request consumer index, from here on, the request
* should not be used (it may be overrinden by a response) */
mount->ring.req_cons++;
static void dispatch_file_write(struct fs_mount *mount, struct fsif_request *req)
{
void *buf;
- int fd, count, i;
+ int fd, count;
uint16_t req_id;
unsigned short priv_id;
struct fs_request *priv_req;
static void dispatch_stat(struct fs_mount *mount, struct fsif_request *req)
{
- struct fsif_stat_response *buf;
struct stat stat;
int fd, ret;
uint16_t req_id;